<template>
  <div class="list">
    <div>通道状态：<span :class="enter_status === -200 || enter_status === -100 || enter_status === -110 || enter_status === 313 || enter_status === 913 ? 'err' : enter_status === 200 || enter_status === 500 ? 'succ' : 'tip'">
      {{ enter_status === -200 ? '审核未通过' : enter_status === -100 ? '入驻失败' : enter_status ===  0 ? '资料提审' : enter_status === 101 ? '已初审，待入驻' : enter_status === 100 ? '入驻中' : enter_status === -110 ? '入驻失败' : enter_status === 200 ? '已入驻' : enter_status === 311 ? '等待配置支付通道' : enter_status === 312 ? '部分支付通道配置成功' : enter_status === 313 ? '支付通道配置失败' : enter_status === 310 ? '支付通道配置成功' : enter_status === 500 ? '完成' : enter_status === 900 ? '申请修改信息' : enter_status === 901 ? '信息修改中' : enter_status === 910 ? '申请修改费率' : enter_status === 911 ? '费率修改中' : enter_status === 912 ? '费率修改完成' : enter_status === 913 ? '费率修改失败' : '无' }}</span>
    </div>
    <div>门店名称：<span>{{ model.store_name }}</span></div>
    <div>经营地址：<span>{{ model.area }}</span></div>
    <div>详细地址：<span>{{ model.address }}</span></div>
    <div>行业类型：<span>{{ model.mcc }}</span></div>
    <div>渠道选择：<span>{{ model.balance_type }}</span></div>
    <div v-if="model.card === 3">POS机配置：<span>{{ model.card === 3 ? '已配置' : '未配置' }}</span></div>
    <div v-if="model.card === 3">借记卡D+0费率：<span>{{ model.debit_d0 }}%</span></div>
    <div v-if="model.card === 3">借记卡D+1费率：<span>{{ model.debit_d1 }}%</span></div>
    <div v-if="model.card === 3">借记卡D+1封顶金额：<span>{{ model.debit_money }}元</span></div>
    <div v-if="model.card === 3">贷记卡D+0费率：<span>{{ model.credit_d0 }}%</span></div>
    <div v-if="model.card === 3">贷记卡D+1费率：<span>{{ model.credit_d1 }}%</span></div>
    <div v-if="model.card === 3">境外卡D+0费率：<span>{{ model.ovsea_d0 }}%</span></div>
    <div v-if="model.card === 3">境外卡D+1费率：<span>{{ model.ovsea_d1 }}%</span></div>
    <div>微信通道签约费率D+0：<span>{{ model.wx_t0 }}%</span></div>
    <div>微信通道签约费率D+1：<span>{{ model.wx_t1 }}%</span></div>
    <div>支付宝通道签约费率D+0：<span>{{ model.ali_t0 }}%</span></div>
    <div>支付宝通道签约费率D+1：<span>{{ model.ali_t1 }}%</span></div>
    <div v-if="model.card === 3" class="weui-cells weui-cells_form" id="uploader">
      <div class="weui-cell">
          <div class="weui-cell__bd">
            <div class="weui-uploader">
              <div class="weui-uploader__hd">
                <div class="weui-uploader__title">证件照片</div>
              </div>
              <div class="weui-uploader__bd">
                <div class="weui-uploader_box" v-if="model.channel_lepos_netprot" >
                  <div class="weui-uploader__input-box">
                    <img :src="model.channel_lepos_netprot" alt="">
                  </div>
                  <p><span class="err">*</span>入网协议</p>
                </div>
                <div class="weui-uploader_box" v-if="model.store_licence_hyg">
                  <div class="weui-uploader__input-box">
                    <img :src="model.store_licence_hyg" alt="">
                  </div>
                  <p><span class="err">*</span>食品卫生许可证</p>
                </div>
                <div class="weui-uploader_box" v-if="model.ch_lpos_certi">
                  <div class="weui-uploader__input-box">
                    <img :src="model.ch_lpos_certi" alt="">
                  </div>
                  <p>授权书</p>
                </div>
                <div class="weui-uploader_box" v-if="model.channel_lepos_agreement">
                  <div class="weui-uploader__input-box">
                    <img :src="model.channel_lepos_agreement" alt="">
                  </div>
                  <p>租凭协议或房产证明</p>
                </div>
              </div>
            </div>
          </div>
      </div>
    </div>
  </div>
</template>

<script>
  import { selaemanChannelLeInit } from "@/api/salesman"

  export default {
    name: 'leInfo',
    data() {
      return {
        enter_status: '',
        error_info: '',
        model: {
          card: '',
          mcc: '',
          area: '',
          credit_d0: '',
          credit_d1: '',
          debit_d0: '',
          debit_d1: '',
          ovsea_d1: '',
          ovsea_d0: '',
          address: '',
          wx_t0: '',
          wx_t1: '',
          ali_t0: '',
          ali_t1: '',
          store_name: '',
          debit_money: '',
          balance_type: '',
          ch_lpos_certi: '',
          store_licence_hyg: '',
          channel_lepos_netprot: '',
          channel_lepos_agreement: ''
        }
      }
    },
    methods: {
      handleDocumentInit() {
        selaemanChannelLeInit(this.$route.query.merchant_num).then(res => {
          if (res.data.errorCode === 0) {
            this.model.area = res.data.result.area.name.toString()
            this.model.store_name = res.data.result.mch_short_name
            this.model.address = res.data.result.address
            this.model.card = res.data.result.card
            this.model.mcc = res.data.result.mcc.name
            this.model.balance_type = res.data.result.balance_type
            this.model.credit_d1 = Number(res.data.result.pos_rates.credit.d1.rate)
            this.model.credit_d0 = Number(res.data.result.pos_rates.credit.d0.rate)
            this.model.debit_d1 = Number(res.data.result.pos_rates.debit.d1.rate)
            this.model.debit_d0 = Number(res.data.result.pos_rates.debit.d0.rate)
            this.model.ovsea_d0 = Number(res.data.result.pos_rates.ovsea.d0.rate)
            this.model.ovsea_d1 = Number(res.data.result.pos_rates.ovsea.d1.rate)
            this.model.wx_t0 = Number(res.data.result.rates_t0.wx)
            this.model.wx_t1 = Number(res.data.result.rates_t1.wx)
            this.model.ali_t0 = Number(res.data.result.rates_t0.ali)
            this.model.ali_t1 = Number(res.data.result.rates_t1.ali)
            this.model.debit_money = Number(res.data.result.pos_rates.debit.d1.ceiling)
            this.model.wx_t0 = res.data.result.rates_t0.wx
            this.model.wx_t1 = res.data.result.rates_t1.wx
            this.model.ali_t0 = res.data.result.rates_t0.ali
            this.model.ali_t1 = res.data.result.rates_t1.ali
            this.model.channel_lepos_agreement = res.data.result.photo.channel_lepos_place_evid
            this.model.channel_lepos_netprot = res.data.result.photo.channel_lepos_netprot
            this.model.store_licence_hyg = res.data.result.photo.store_licence_hyg
            this.model.ch_lpos_certi = res.data.result.photo.ch_lpos_certi
            this.enter_status = res.data.result.enter_status.code
            this.error_info = res.data.result.enter_status.error_info
          } else {
            this.$weui.alert(res.data.errorMsg)
          }
        })
      }    
    },
    created() {
      this.handleDocumentInit()
    }
  }
</script>
<style lang="scss" scoped>
  @import '@/styles/index.scss';
  .list {
    width: px2rem(670px);
    min-height: px2rem(640px);
    background:rgba(255,255,255,1);
    box-shadow:0px 0px px2rem(15px) rgba(188,188,188,0.4);
    padding: px2rem(20px);
    margin: 0 auto;
    margin-top: px2rem(30px);
    color: #444;
    font-size: px2rem(28px);
    &>div {
      padding: px2rem(20px) 0;
    }
  }
</style>
